package com.homework4;



import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * @author :  DongZheng Wang
 * @PROJECT_NAME: java泛型
 * @date :  2022-10-27 10:50
 **/
public class Mytest6 {
    public static void main(String[] args) throws NoSuchMethodException, IllegalAccessException, InstantiationException, InvocationTargetException {
        Class<Mytest8> mytest8Class = Mytest8.class;
        Mytest8 mytest8 = mytest8Class.newInstance();

        Method test1 = mytest8Class.getDeclaredMethod("test1", Integer.class, String.class);
        test1.invoke(mytest8,12,"test");
        System.out.println(test1);


        Method test2 = mytest8Class.getDeclaredMethod("test2");
        test2.invoke(mytest8);
        System.out.println(test2);
    }
}
class Mytest7{
    public void test1() {
        System.out.println("Hello");
    }
    public void test2(Integer a,String b) {
        System.out.println("a"+a+"b="+b);
    }
}
class Mytest8 extends Mytest7{
    public void test1(Integer a,String b) {
        System.out.println("a"+a+"b="+b);
    }
    public void test2() {
        System.out.println("~~~~");
    }
    }